PROJECT TIMOTHY
(Group 74 #1)
Caitlin Haisler, Jennifer Luebbers,
Scheile Preston, Andrew Xu
APPROACH TO THE PROBLEM
The first
objective of Project Timothy was to implement an A* pathfinding algorithm that
guided the robot around any obstacles to the specified waypoints in the course.
The A* algorithm is called for the first time when the robot is turned on, and
the first waypoint is set as the robot's destination. When the robot comes
within half a tile of its destination, the next waypoint is set as its new
destination. The XY coordinates of the robot are constantly tracked by the Optitrack camera system. The robot uses its XY position as
well as the LADAR sensor to mark obstacles in the course in a map character
array. The robot used data from the LADAR in 10-degree increments to build an
obstacle map that was highly accurate. If the robot encountered a new obstacle,
it re-ran the A* algorithm to find an alternate route. The A* algorithm always
guided the robot to its destination with the purpose of traveling as short a
distance as possible.
The next
goal for Timothy was to program the robot to locate and kill both pink and blue
weeds strewn about the course. The weeds were supposed to be killed only once,
and the robot had to keep track of the number and color of weeds killed. The
first step in accomplishing this task was to establish an accurate HSV range
for both the pink and blue weeds in the course using the provided HSV Matlab code. Next, the Colorvision
code that processed the data received from the camera checked to see if there
was an object (checking alternately for pink or blue) in the proper HSV range
to be considered a weed and noted the number of pixels the object consisted of.
The Colorvision file then sent the location of the
centroid of the object on the LCD screen to the main C file.
With each
loop through the main C file, the number of pixels of the pink or blue object
was compared to the threshold value, determining if the object was large enough
to be a weed. If it was large enough, Timothy paused from following its A*
path, turned, and looked at the weed. It then determined the world XY location
of the weed in the course by converting the centroid location of the weed from
the camera coordinates to a distance in world coordinates. The robot used this
distance and its own XY position and angle to calculate the XY position of the
weed. If the robot had not already killed a weed within 1 tile in any direction
of the weed it was looking at, it moved forward towards the weed using its centroid
location rom the camera. When the weed was almost out of sight of the camera,
the robot switched from following the weed to moving forward in a straight line
blindly for a specified amount of time.
After this, the robot would be sitting directly over the weed and stop
for one second to kill the weed. The robot stored its current XY location in an
array to keep track of the positions of the weeds already killed. With the
location of the weed marked, the robot re-ran the A* algorithm to continue
traveling to the next waypoint.
A case
statement made up of five possible states determined the robot's
"mission" or objective at any given moment. State 1 contained the
instructions for the robot to continue following its current a* path. While in
State 1, if the robot's camera picked up a blue or pink object that had above
the established threshold of pixels, the robot set a flag marking which color
weed it found and sent the robot into State 3, interrupting the instructions
for the a* path.
While in
State 3, the robot stopped moving forward and was allowed time to turn and look
at the weed. It recorded the centroid location of the weed it was looking at
and then calculated the location of the weed in the map to see if it had
already killed it. If it had not yet killed the weed, the robot moved into
State 4. If the weed had been killed, the robot moved into State 2, which
updated the A* path to lead the robot onto the next waypoint.
While in
State 4, the robot slowly moved directly towards the weed until it was a
specified distance away. Once it reached this distance, the robot was sent into
State 5. In State 5, the robot blindly moved forward for a given amount of time
until it was positioned directly over the weed. (This time was determined by
trial and error.) Once over the weed, the robot paused for one second, added
its current XY position (also the location of the weed) to an array, and
incremented the appropriate blue or pink weed count. Finally, it moved into
State 2 where the A* path was recalculated to lead the robot to the next
waypoint.
The above
process was repeated until either 5 weeds were found or all the waypoints had
been reached. If 5 weeds were found before all the waypoints were reached,
Timothy would continue traveling to the waypoints without looking for any more
weeds.
After all
the waypoints had been reached, the robot moved outside the course to first the
blue, and then the pink circles. It paused inside each circle and used a
mounted servo motor to display the number of blue or pink weeds respectively it
had killed in its completed run.
ROBOT
PERFORMANCE VIDEOS
<iframe width="640" height="360"
src="https://www.youtube.com/embed/3EwDMdCAhGg?list=PLwp-z5nCWTcIfgAqs9FA68o0gB3oPM2O_"
frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<iframe width="640" height="360"
src="https://www.youtube.com/embed/ZyDiU8ioSvM?list=PLwp-z5nCWTcIfgAqs9FA68o0gB3oPM2O_"
frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
COURSE 2: 162.25 (time) – 100 (all 5 weeds found) – 60 (all 5 weeds
killed) – 40 (no touch) FINAL SCORE = -37.25
LABVIEW FEATURES
Timothy includes five features in its companion LabVIEW program:
·
Standard grid coordinate and wall drawing in the main
display
·
Main display traces the robot’s path, with a radius
toggle to adjust size of robot’s circle
·
Weed find indicator shows coordinates of found
weeds, the color, and also plots in on the main display, with the dot
correlating with its color
·
Obstacles show up in the main display as green dots
·
The next waypoint that the Robot heads to shows up
in the main display as a red dot, and previous waypoints show up as brown dots.
OTHER USER
FRIENDLY FEATURES ON TIMOTHY
Timothy
utilizes the five LEDs that are arranged in a circle to indicate what state
Timothy is in. This allows for quick diagnosing, as the LEDs are easier to see
than the LCD screen in the back.
State 1 (following A* determined
path) - LEDs flash counterclockwise
State 2
(Recalculating A*) – All LEDs on
State 3
(Camera sees color) – LED 2 on
State 4
(Robot goes towards color) – LED 3 on
State 5
(Robot is in open-loop mode) – LED 4 on
State 6
(Robot is in blue hexagon) – LED 5 on
State 7
(Robot is in pink hexagon and course is complete) – All LEDs flash at the same
time.
Dials in the
front of the robot show how many pink and blue weeds are killed. The dials are
controlled using two servos and display once the robot reaches the pink or blue
hexagon.
The LCD screen displays different
information according to which mode it is in.
While the
robot is running the course, the screen will display “Project Timothy” on the
first line, and displays the current number of blue and pink weeds as well as X
and Y coordinates on the second line.
When the
robot gets to the blue hexagon, the screen will display “Blue Hexagon” on the
first line and display the final number of blue weeds on the second line.
When the
robot gets to the pink hexagon, the screen will first display “Pink Hexagon” on
the first line and display the final number of pink weeds on the second line.
After 3 seconds the screen will display “Maze Completed!” and display the
number of blue, pink, and total weeds.
THE TEAM
(Left to Right) Caitlin Haisler,
Scheile Preston, Jennifer Luebbers, Andrew Xu